package com.baomidou.ant.service.impl;

import com.baomidou.ant.entity.ErrorBook;
import com.baomidou.ant.mapper.ErrorBookMapper;
import com.baomidou.ant.service.IErrorBookService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jobob
 * @since 2021-03-24
 */
@Service
public class ErrorBookServiceImpl extends ServiceImpl<ErrorBookMapper, ErrorBook> implements IErrorBookService {
    @Override
    public ErrorBook queryByUserId(Integer userId) {
        QueryWrapper<ErrorBook> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("user_id",userId);
        List<ErrorBook> errorBookList=list(queryWrapper);
        if(errorBookList!= null && errorBookList.size()>0){
            return errorBookList.get(0);
        }else
            return null;
    }
}

